using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Xml.Serialization;

namespace CSettingsUI
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
    public class SettingForm : CSettingsUI.PropertyConverterForm
	{
		#region members
		//private Settings settingClass = new Settings();
		//private Settings settingClassClone;
        private object selectedClassClone;

        private object selectedObject;


		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		#endregion

		public SettingForm()
		{
              //
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//		
		}
        public object SelectedObject
        {
            get
            {
                return this.selectedObject;

            }
            set
            {

                selectedObject = value;
                selectedClassClone = ((ICloneable)selectedObject).Clone();
                CSettingsUI.PropertyConverter o = new CSettingsUI.PropertyConverter(selectedClassClone, this);
     
            }
           }

		#region events
		protected override void OnAcceptChanges(CancelEventArgs e)
		{
            selectedObject = selectedClassClone;
			//SaveSettings();
			base.OnAcceptChanges (e);
		}

		protected override void OnLoad(EventArgs e)
		{	
			
			base.OnLoad (e);
		}

		#endregion

	
		

		#region Windows Form Designer generated code

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            ((System.ComponentModel.ISupportInitialize)(this.propertyTree)).BeginInit();
            this.SuspendLayout();
            // 
            // propertyTree
            // 
            this.propertyTree.PaneHeaderVisible = true;
            this.propertyTree.ShowPlusMinus = false;
            // 
            // btnOk
            // 
            this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
            // 
            // SettingForm
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(584, 342);
            this.Name = "SettingForm";
            ((System.ComponentModel.ISupportInitialize)(this.propertyTree)).EndInit();
            this.ResumeLayout(false);

		}
		#endregion

        private new void btnOk_Click(object sender, EventArgs e)
        {
            selectedObject = selectedClassClone;
            base.btnOk_Click(sender, e);
            //SaveSettings();
           
        }

      
	
	}
}
